//
//  IFlyAudioPlayer.h
//  AIKITDemo
//
//  Created by xyzhang on 2023/3/1.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "IFlyAudioPlayerDelegate.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, IFlyPlayTrack) {    //声道类型
    IFLY_STEREO     = 1,                 //立体声
    IFLY_MONO       = 2                  //单声道
};

typedef NS_ENUM(NSInteger, IFlyPlayerState) {
    IFlyPlayerStateInit         = 0x00,             //初始状态
    IFlyPlayerStateBuffer       = 0x01,             //正在缓冲
    IFlyPlayerStatePlaying      = 0x02,             //正在播放
    IFlyPlayerStatePause        = 0x03,             //正在暂停
    IFlyPlayerStateResume       = 0x04,             //恢复播放
    IFlyPlayerStateCancel       = 0x05,             //取消状态
    IFlyPlayerStateEnd          = 0x06              //播放完成
};

@interface IFlyAudioPlayer : NSObject

/// 采样率，默认16000
@property (nonatomic, assign) NSUInteger sampleRate;

/// 写入的音频流的声道数，默认单通道
@property (nonatomic, assign) IFlyPlayTrack soundTrack;

/// 音频数据的位深，默认是16，主要包括8，16，24，32四种
@property (nonatomic, assign) NSUInteger bitDepth;

//@property (nonatomic, weak) (id)<IFlyAudioPlayerDelegate> delegate;
@property (nonatomic,assign)      id<IFlyAudioPlayerDelegate> delegate;

+ (IFlyAudioPlayer *)sharedInstance;

- (BOOL)play;

- (void)pause;

- (void)resume;

- (void)stop;

//- (BOOL)appendAudioData:(NSData *)audioData progress:(NSUInteger)progress isLast:(BOOL) isLast;

//- (IFlyPCMState) curState;

@end

NS_ASSUME_NONNULL_END
